package com.example.myproject.client;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.VerticalPanel;

public class DisplayPanel extends DockPanel{

	Modules modList;
	
	/*Constructor for display panel, takes in a references to a module list
	 * 
	 */
	DisplayPanel(Modules moduleList)
	{
		//set modlist
		modList = moduleList;
		//set components
		this.setSize("642px", "400px");
		this.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
	    this.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
		this.setStyleName("borderStyle");
		
		//test button, remove right after to set display panel size
		this.add(new Button("nom"), DockPanel.WEST);
		this.clear();
	}
	
	
	/*************************************************************************
	 * setDisplay is intended to set the display for each type of display when
	 * a button is pressed on selection panel, the num referes to what type of 
	 * display it is
	 * **********************************************************************/	
	void SetDisplay(int num, Module mod)
	{
		switch(num)
		{
			//if it's 1, you are setting the display panel to the modules settings display
			case 1:
			{
				//remove all components first
				this.clear();
				//create a new panel, add selected module too it
				VerticalPanel temp = new VerticalPanel();
				temp.add(modList.getSelectedModuleInfo());//, DockPanel.WEST);
				this.add(temp, DockPanel.WEST);
				break;
			}
			case 2:
			{
				break;
			}
			default:
			{
				this.clear();
				break;
			}
		}
		
	}
}
